package com.ybliang.plat.cms.service.impl;

import com.ybliang.plat.cms.feign.UserFeignClient;
import com.ybliang.plat.cms.model.BannerModel;
import com.ybliang.plat.cms.service.BannerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class BannerServiceImpl implements BannerService {

    public static Logger LOGGER = LoggerFactory.getLogger(BannerServiceImpl.class);

    @Autowired
    UserFeignClient userFeignClient;

    @Override
    public List<BannerModel> getBannerList() {
        BannerModel banner = new BannerModel();
        banner.setId(1L);
        banner.setLink("http://www.baidu.com/");
        List<BannerModel> list = new ArrayList<>();
        list.add(banner);
        return list;
    }

    @Override
    public Map<String, Object> getAllList() {
        Map<String, Object> map = new HashMap<>();
        map.put("banner", getBannerList());
        map.put("user", userFeignClient.findByMobile("17688705466"));
        map.put("info", userFeignClient.info());
        return map;
    }
}
